<template>
  <!-- 单项 -->
  <el-menu-item v-if="!v.children || v.children.length <= 0" :index="v.fullPath">
    <i v-if="v.meta.icon" class="menu-icon iconfont" :class="v.meta.icon"></i>
    <template #title>
      <span>{{ v.meta.title }}</span>
    </template>
  </el-menu-item>
  <!-- 层级 -->
  <el-sub-menu v-else :index="v.fullPath">
    <template #title>
      <i v-if="v.meta.icon" class="menu-icon iconfont" :class="v.meta.icon"></i>
      <span>{{ v.meta.title }}</span>
    </template>
    <AsideItem v-for="val in v.children" :key="val.path" :v="val" />
  </el-sub-menu>
</template>

<script lang="ts" setup>
import AsideItem from "./AsideItem.vue";

interface Props {
  v?: AnyObject
}

const { v } = withDefaults(defineProps<Props>(), {
  v: () => ({})
})
</script>